//package com.gyh.thymeleaf.config;
//
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
//
//import javax.security.auth.login.Configuration;
//
///**
// * @author gyhstart
// * @create 2020/6/15 - 21:16
// **/
//public class MySecurityConfig extends WebSecurityConfigurerAdapter {
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        //定制授权规则
//        http.authorizeRequests().antMatchers("/").permitAll()
//                .antMatchers("/level1").hasRole("vip1")
//                .antMatchers("/level2").hasRole("vip2");
//        http.logout().logoutSuccessUrl("/login");
//    }
//
//    //定义认证规则
//    @Override
//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//       // super.configure(auth);
//        auth.inMemoryAuthentication()
//                .withUser("Tom").password("123456").roles("vip1")
//                .and()
//                .withUser("Jam").password("123321").roles("vip2");
//    }
//}
